/*
-------------------------------------------------------------------
BIE is Copyright 2001-2003 Brunswick Corp.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/bie_license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
*/
package com.webdeninteractive.sbie;

import com.webdeninteractive.sbie.config.BootConfig;
import com.webdeninteractive.sbie.config.SystemConfig;

/**
 * An SBIE RemoteSystem provides services to start and stop Client
 * implementations.
 * <p>
 * A RemoteSystem has an associated configuration, which specifies
 * a set of Clients to start when RemoteSystem.start() is called.
 *
 * @author  bmadigan
 * @version $Id: RemoteSystem.java,v 1.1.1.1 2003/05/20 16:56:49 gdf Exp $
 */
public interface RemoteSystem {

    /** The BootStrapper will pass this RemoteSystem what it knows about
     *  the configuration.  The implementation can use this to 
     *  configure itself (or to figure out how to configure itself).
     *
     * @param configuration BootConfig the BootStrapper used to start.
     */
    public void setConfiguration( BootConfig configuration );

    /** Retrieve the configuration object associated with this 
     *  RemoteSystem.  This will be based on the BootConfig supplied via
     *  <CODE>setConfiguration</CODE>, but will be a SystemConfig instance.
     * @return configuration object for this RemoteSystem.
     */
    public SystemConfig getConfiguration();

    /** The BootStrapper will create and initialize a ClassLoader
     *  to use for generating new runtime objects.
     *
     * @param loader ClassLoader created during bootstrapping process.
     */
    public void setClassLoader( ClassLoader loader );

    /** @return The ClassLoader for creating objects for this RemoteSystem. */
    public ClassLoader getClassLoader();

    /** Resets RemoteSystem state, and calls startClient() for each of
     *  the set of Client implementations configured for run time.
     */
    void start();

    /** Signals all started Client implementations to halt, and
     *  performs any necessary cleanup.
     */
    void stop();

    /** Restart the RemoteSystem.  Equivalent to:
     *  "<code>remoteSystem.stop();  remoteSystem.start();</code>".
     */
    void restart();


    /** Create and start a named Client implementation. 
     * @param clientName the name of the Client implementation to start.
     */
    void startClient( String clientName );


    /** Signal a previously started Client implementation to halt.
     * @param clientName the name of the Client implementation to stop.
     */
    void stopClient( String clientName );

}
